//
//  DKUnathorizedSigleView.m
//  DanKU
//
//  Created by 吴斌 on 2023/10/24.
//

#import "DKUnathorizedSigleView.h"
@interface DKUnathorizedSigleView()
@property (nonatomic, strong)UIImageView * unathorizedSigleImgView;
@property (nonatomic, strong)UILabel * unathorizedSigleLab;
@end
@implementation DKUnathorizedSigleView
-(instancetype)init{
    if(self == [super init]){
        self.backgroundColor = UIColor.whiteColor;
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    self.unathorizedSigleImgView = [[UIImageView alloc] init];
    self.unathorizedSigleImgView.userInteractionEnabled = YES;
    [self addSubview:self.unathorizedSigleImgView];
    [self.unathorizedSigleImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(@(-DK_IsWidthScale(0)));
        make.width.equalTo(@(DK_IsWidthScale(28)));
        make.height.equalTo(@(DK_IsWidthScale(28)));
    }];
    self.unathorizedSigleLab = [[UILabel alloc] init];
    self.unathorizedSigleLab.textColor = DK_Hex(@"#1D1D1D");
    self.unathorizedSigleLab.font = DK_FONT_Semibold(12);
    self.unathorizedSigleLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.unathorizedSigleLab];
    [self.unathorizedSigleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(0)));
        make.right.equalTo(@(-DK_IsWidthScale(0)));
        make.top.equalTo(self.unathorizedSigleImgView.mas_bottom).offset(DK_IsWidthScale(6));
    }];
    UIButton * unathorizedSigleBtn = [[UIButton alloc] init];
    [unathorizedSigleBtn addTarget:self action:@selector(clickFun) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:unathorizedSigleBtn];
    [unathorizedSigleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@(DK_IsWidthScale(0)));
    }];
}
-(void)setUnathorizedSigleType:(UnathorizedSigleType)unathorizedSigleType{
    _unathorizedSigleType = unathorizedSigleType;
    if(_unathorizedSigleType == UnathorizedSigleTypeFAQ){
        self.unathorizedSigleImgView.image = DK_GetImage(@"dk_MainFaq");
        self.unathorizedSigleLab.text = @"FAQ>";
    }else if (_unathorizedSigleType == UnathorizedSigleTypeService){
        self.unathorizedSigleImgView.image = DK_GetImage(@"dk_MainService");
        self.unathorizedSigleLab.text = @"Service>";
    }else if (_unathorizedSigleType == UnathorizedSigleTypeSComplaint){
        self.unathorizedSigleImgView.image = DK_GetImage(@"dk_MainComplaint");
        self.unathorizedSigleLab.text = @"Complaint>";
    }
}
- (void)clickFun{
    if(self.ClickFunBlock){
        self.ClickFunBlock();
    }
}
@end
